#!/usr/bin/env python
#coding: utf-8

def ask_ok(prompt, retries=4, complaint='\'S\'im ou Nao, Por favor!'):
    """ Requisita a resposta do usuário para finalizar """
    while True:
        ok = raw_input(prompt)
        if ok in ('y', 'ye', 'yes','sim','s','1'): return True
        if ok in ('n', 'no', 'nop', 'nope','nao','Nao','0'): return False
        retries = retries -1
        if retries < 0: raise IOError, 'refusenik user'
        print complaint


if __name__=="__main__":
  ask_ok("qual? ")
  

